package org.adorsys.aderp.aderplogin.web.ext;

import java.io.IOException;
import java.util.List;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

@RequestMapping({"/admin"})
@Controller
public class AdminController {
	
	@Resource
	private WorkspaceService workspaceService;

	@RequestMapping(method = RequestMethod.GET)
	public String selectPage(Model uiModel, HttpServletRequest request, HttpServletResponse response) throws IOException{
		if(uiModel!=null){
			List<Workspace> workspaces = workspaceService.selectWorkspaces();
			uiModel.addAttribute("workspaces", workspaces);
		}
    	return "/admin";
	}
}
